<template>
  <div class="main">
      <form-create
          id="printTable"
          v-model="formData"
          v-model:api="fapi"
          :rule="rule"
          :option="option"
          @submit="onSubmit"
      ></form-create>
    <el-button v-print="printObj" class="mysite" type="success" @click="onReset">打印</el-button>
    <el-upload class="mysite1" action="http://localhost:9090/api/upload" :on-success='message' :show-file-list="false" >
      <el-button type="primary" @click="setPath">上传</el-button>
    </el-upload>

  </div>

</template>

<script>
import formCreate from "@form-create/element-ui";
import request from "@/util/request";
import {ElMessage} from "element-plus";


export default {
  component: {
    formCreate: formCreate.$form()
  },
  data () {
    const option = formCreate.parseJson('{"form":{"inline":false,"hideRequiredAsterisk":false,"labelPosition":"left","size":"defult","labelWidth":"25px","showMessage":false,"labelSuffix":""},"resetBtn":{"show":false,"innerText":"打印"},"submitBtn":{"show":true,"innerText":"提交"}}');
    return {
      formData: {},
      fapi: null,
      rule: formCreate.parseJson('[{"type":"fcTable","props":{"rule":{"row":8,"col":8,"style":{"4:1":{"height":"30px"},"4:4":{"height":"30px"},"4:3":{"height":"30px"},"5:1":{"height":"30px"},"5:3":{"height":"30px"},"5:4":{"height":"30px"},"4:6":{"height":"30px"},"5:6":{"height":"30px"},"6:1":{"height":"30px"},"6:4":{"height":"30px"},"6:3":{"height":"30px"},"6:6":{"height":"30px"},"7:6":{"height":"30px"},"7:4":{"height":"30px"},"7:3":{"height":"30px"},"7:1":{"height":"30px"},"2:0":{"height":"30px"},"3:0":{"height":"30px"}},"class":{},"layout":[{"top":2,"left":0,"col":6},{"top":3,"left":0,"col":6},{"top":4,"left":0,"row":4},{"top":4,"left":1,"col":2},{"top":4,"left":4,"col":2},{"top":5,"left":1,"col":2},{"top":5,"left":4,"col":2},{"top":4,"left":6,"col":2},{"top":5,"left":6,"col":2},{"top":6,"left":1,"col":2},{"top":7,"left":1,"col":2},{"top":6,"left":4,"col":2},{"top":7,"left":4,"col":2},{"top":6,"left":6,"col":2},{"top":7,"left":6,"col":2},{"top":2,"left":6,"col":2,"row":2}]},"borderColor":"#191818FF"},"children":[{"type":"div","title":"","native":true,"children":["姓名"],"_fc_id":"id_Faoolxwllwtod6c","name":"ref_Fk22lxwllwtod7c","display":true,"hidden":false,"_fc_drag_tag":"text","slot":"0:0"},{"type":"input","field":"F6bulxwlm92mdmc","title":"","info":"","$required":false,"_fc_id":"id_Fkwklxwlm92mdnc","name":"ref_Fehrlxwlm92mdoc","display":true,"hidden":false,"_fc_drag_tag":"input","slot":"0:1"},{"type":"div","title":"","native":true,"children":["性别"],"_fc_id":"id_F3jblxwlly09d8c","name":"ref_Fmnilxwlly09d9c","display":true,"hidden":false,"_fc_drag_tag":"text","slot":"0:2"},{"type":"input","field":"Fvpqlxwlmcv1dsc","title":"","info":"","$required":false,"_fc_id":"id_Fcbzlxwlmcv1dtc","name":"ref_Ffe5lxwlmcv1duc","display":true,"hidden":false,"_fc_drag_tag":"input","slot":"0:3"},{"type":"div","title":"","native":true,"children":["身份证号"],"_fc_id":"id_Fqtslxwlm2rndec","name":"ref_Fw8plxwlm2rndfc","display":true,"hidden":false,"_fc_drag_tag":"text","slot":"1:0"},{"type":"input","field":"Flqzlxwlma4wdpc","title":"","info":"","$required":false,"_fc_id":"id_Fa0elxwlma4wdqc","name":"ref_Fcr7lxwlma4wdrc","display":true,"hidden":false,"_fc_drag_tag":"input","slot":"1:1"},{"type":"div","title":"","native":true,"children":["申请准驾车型号"],"_fc_id":"id_Fiowlxwlm3vmdgc","name":"ref_F5ozlxwlm3vmdhc","display":true,"hidden":false,"_fc_drag_tag":"text","slot":"1:2"},{"type":"input","field":"Fvoqlxwlme7xdvc","title":"","info":"","$required":false,"_fc_id":"id_F1jxlxwlme7xdwc","name":"ref_Fwv9lxwlme7xdxc","display":true,"hidden":false,"_fc_drag_tag":"input","slot":"1:3"},{"type":"div","title":"","native":true,"children":["出生年月"],"_fc_id":"id_Flkblxwllyysdac","name":"ref_Fa7glxwllyysdbc","display":true,"hidden":false,"_fc_drag_tag":"text","slot":"0:4"},{"type":"datePicker","field":"Fx2mlxwlnpthfmc","title":"","info":"","$required":false,"_fc_id":"id_Fi8nlxwlnpthfnc","name":"ref_Fcpelxwlnpthfoc","display":true,"hidden":false,"_fc_drag_tag":"datePicker","slot":"0:5"},{"type":"div","title":"","native":true,"children":["档案编号"],"_fc_id":"id_Fvx7lxwlm547dic","name":"ref_Fp2dlxwlm547djc","display":true,"hidden":false,"_fc_drag_tag":"text","slot":"1:4"},{"type":"input","field":"Fzxslxwlmi9rdyc","title":"","info":"","$required":false,"_fc_id":"id_Fa3blxwlmi9sdzc","name":"ref_Fr0qlxwlmi9se0c","display":true,"hidden":false,"_fc_drag_tag":"input","slot":"1:5"},{"type":"div","title":"","native":true,"children":["民族"],"_fc_id":"id_F5e1lxwlm0l5dcc","name":"ref_Fn70lxwlm0l5ddc","display":true,"hidden":false,"_fc_drag_tag":"text","slot":"0:6"},{"type":"input","field":"Fsfolxwlmwokfjc","title":"","info":"","$required":false,"_fc_id":"id_Fok7lxwlmwokfkc","name":"ref_Frfqlxwlmwokflc","display":true,"hidden":false,"_fc_drag_tag":"input","slot":"0:7"},{"type":"div","title":"","native":true,"children":["联系电话"],"_fc_id":"id_Fltblxwlm68qdkc","name":"ref_Fs1zlxwlm68qdlc","display":true,"hidden":false,"_fc_drag_tag":"text","slot":"1:6"},{"type":"input","field":"Fulslxwlmu3tfgc","title":"","info":"","$required":false,"_fc_id":"id_Fm6qlxwlmu3tfhc","name":"ref_Fyiylxwlmu3tfic","display":true,"hidden":false,"_fc_drag_tag":"input","slot":"1:7"},{"type":"radio","field":"Fj05lxwlr68hfyc","title":"本人如实申报","info":"","effect":{"fetch":""},"$required":false,"options":[{"label":"具有","value":2},{"label":"不具有","value":3}],"_fc_id":"id_Fy25lxwlr68hfzc","name":"ref_Fh8olxwlr68hg0c","display":true,"hidden":false,"_fc_drag_tag":"radio","wrap":{"labelWidth":"120px"},"slot":"2:0"},{"type":"checkbox","field":"Fopclxwlvpmwgec","title":"","info":"","effect":{"fetch":""},"$required":false,"options":[{"label":"器质性心脏病","value":2},{"label":"癫痫","value":3},{"label":"美尼尔氏症","value":4},{"label":"眩晕","value":"5"},{"label":"癔症","value":"6"},{"label":"震颤麻痹","value":"7"},{"label":"精神病","value":"8"},{"label":"痴呆","value":"9"}],"_fc_id":"id_Fklqlxwlvpmwgfc","name":"ref_Fhqzlxwlvpmwggc","display":true,"hidden":false,"_fc_drag_tag":"checkbox","slot":"3:0"},{"type":"div","title":"","native":true,"children":["医院机构检查表"],"_fc_id":"id_Fochlxwlzti2hjc","name":"ref_Fd26lxwlzti2hkc","display":true,"hidden":false,"_fc_drag_tag":"text","slot":"4:0"},{"type":"div","title":"","native":true,"children":["身高"],"_fc_id":"id_Fx5glxwm1z65i0c","name":"ref_Fbv9lxwm1z65i1c","display":true,"hidden":false,"_fc_drag_tag":"text","slot":"4:1"},{"type":"input","field":"Fannlxwm4yynihc","title":"","info":"","$required":false,"_fc_id":"id_Fltolxwm4yyniic","name":"ref_Fpq9lxwm4yynijc","display":true,"hidden":false,"_fc_drag_tag":"input","slot":"4:3"},{"type":"div","title":"","native":true,"children":["辨色力"],"_fc_id":"id_Fjtplxwm23a2i8c","name":"ref_Fwzxlxwm23a2i9c","display":true,"hidden":false,"_fc_drag_tag":"text","slot":"4:4"},{"type":"input","field":"Fnbilxwm50meikc","title":"","info":"","$required":false,"_fc_id":"id_Fyzolxwm50meilc","name":"ref_Fdk8lxwm50meimc","display":true,"hidden":false,"_fc_drag_tag":"input","slot":"4:6"},{"type":"div","title":"","native":true,"children":["视力"],"_fc_id":"id_Fa4glxwm2098i2c","name":"ref_Ftbjlxwm2098i3c","display":true,"hidden":false,"_fc_drag_tag":"text","slot":"5:1"},{"type":"input","field":"Ftadlxwm5206inc","title":"","info":"","$required":false,"_fc_id":"id_Fy29lxwm5207ioc","name":"ref_Ftzrlxwm5207ipc","display":true,"hidden":false,"_fc_drag_tag":"input","slot":"5:3"},{"type":"div","title":"","native":true,"children":["是否矫正"],"_fc_id":"id_F1iwlxwm2484iac","name":"ref_F08ulxwm2484ibc","display":true,"hidden":false,"_fc_drag_tag":"text","slot":"5:4"},{"type":"radio","field":"F7ynlxwm5869iqc","title":"","info":"","effect":{"fetch":""},"$required":false,"options":[{"label":"正常","value":2},{"label":"异常","value":3}],"_fc_id":"id_Fxc9lxwm5869irc","name":"ref_F50clxwm5869isc","display":true,"hidden":false,"_fc_drag_tag":"radio","slot":"5:6"},{"type":"radio","field":"Ft02lxwm7lu3jxc","title":"","info":"","effect":{"fetch":""},"$required":false,"options":[{"label":"正常","value":2},{"label":"异常","value":3}],"_fc_id":"id_F90blxwm7lu3jyc","name":"ref_F50clxwm5869isc","display":true,"hidden":false,"_fc_drag_tag":"radio"},{"type":"radio","field":"Fkf2lxwm7ih5jtc","title":"","info":"","effect":{"fetch":""},"$required":false,"options":[{"label":"正常","value":2},{"label":"异常","value":3}],"_fc_id":"id_Fy53lxwm7ih5juc","name":"ref_F50clxwm5869isc","display":true,"hidden":false,"_fc_drag_tag":"radio"},{"type":"radio","field":"Fahrlxwm75vsjnc","title":"","info":"","effect":{"fetch":""},"$required":false,"options":[{"label":"正常","value":2},{"label":"异常","value":3}],"_fc_id":"id_Fttalxwm75vsjoc","name":"ref_F50clxwm5869isc","display":true,"hidden":false,"_fc_drag_tag":"radio"},{"type":"radio","field":"F547lxwm75rbjlc","title":"","info":"","effect":{"fetch":""},"$required":false,"options":[{"label":"正常","value":2},{"label":"异常","value":3}],"_fc_id":"id_F0mplxwm75rbjmc","name":"ref_F50clxwm5869isc","display":true,"hidden":false,"_fc_drag_tag":"radio"},{"type":"radio","field":"Fobglxwm75i6jjc","title":"","info":"","effect":{"fetch":""},"$required":false,"options":[{"label":"正常","value":2},{"label":"异常","value":3}],"_fc_id":"id_Fky5lxwm75i6jkc","name":"ref_F50clxwm5869isc","display":true,"hidden":false,"_fc_drag_tag":"radio"},{"type":"radio","field":"F4a3lxwm75awjhc","title":"","info":"","effect":{"fetch":""},"$required":false,"options":[{"label":"正常","value":2},{"label":"异常","value":3}],"_fc_id":"id_Fxe7lxwm75awjic","name":"ref_F50clxwm5869isc","display":true,"hidden":false,"_fc_drag_tag":"radio"},{"type":"radio","field":"Fpn0lxwm6uuejfc","title":"","info":"","effect":{"fetch":""},"$required":false,"options":[{"label":"正常","value":2},{"label":"异常","value":3}],"_fc_id":"id_Fufdlxwm6uuejgc","name":"ref_F50clxwm5869isc","display":true,"hidden":false,"_fc_drag_tag":"radio"},{"type":"radio","field":"Fphllxwm6iiejbc","title":"","info":"","effect":{"fetch":""},"$required":false,"options":[{"label":"正常","value":2},{"label":"异常","value":3}],"_fc_id":"id_Fhhslxwm6iiejcc","name":"ref_F50clxwm5869isc","display":true,"hidden":false,"_fc_drag_tag":"radio"},{"type":"radio","field":"Faz6lxwm69z1j8c","title":"","info":"","effect":{"fetch":""},"$required":false,"options":[{"label":"正常","value":2},{"label":"异常","value":3}],"_fc_id":"id_Fowslxwm69z1j9c","name":"ref_F50clxwm5869isc","display":true,"hidden":false,"_fc_drag_tag":"radio"},{"type":"div","title":"","native":true,"children":["听力"],"_fc_id":"id_Fvholxwm2172i4c","name":"ref_Fym5lxwm2172i5c","display":true,"hidden":false,"_fc_drag_tag":"text","slot":"6:1"},{"type":"radio","field":"Falhlxwm7gl6jqc","title":"","info":"","effect":{"fetch":""},"$required":false,"options":[{"label":"正常","value":2},{"label":"异常","value":3}],"_fc_id":"id_Fh6rlxwm7gl6jrc","name":"ref_Fkyhlxwm7gl6jsc","display":true,"hidden":false,"_fc_drag_tag":"radio","slot":"6:3"},{"type":"radio","field":"Fxmplxwm7jsqjvc","title":"单选框","info":"","effect":{"fetch":""},"$required":false,"options":[{"label":"选项00","value":2},{"label":"选项01","value":3},{"label":"选项02","value":4}],"_fc_id":"id_Fxarlxwm7jsqjwc","name":"ref_Fkyhlxwm7gl6jsc","display":true,"hidden":false,"_fc_drag_tag":"radio"},{"type":"div","title":"","native":true,"children":["上肢"],"_fc_id":"id_Fyuglxwm257dicc","name":"ref_F40slxwm257didc","display":true,"hidden":false,"_fc_drag_tag":"text","slot":"6:4"},{"type":"radio","field":"F1izlxwm88u9k0c","title":"","info":"","effect":{"fetch":""},"$required":false,"options":[{"label":"正常","value":2},{"label":"异常","value":3}],"_fc_id":"id_Fqoelxwm88u9k1c","name":"ref_F3bhlxwm88u9k2c","display":true,"hidden":false,"_fc_drag_tag":"radio","slot":"6:6"},{"type":"div","title":"","native":true,"children":["躯干"],"_fc_id":"id_Fpbolxwm2249i6c","name":"ref_Fqoelxwm2249i7c","display":true,"hidden":false,"_fc_drag_tag":"text","slot":"7:1"},{"type":"radio","field":"Ftzxlxwm8a79k3c","title":"","info":"","effect":{"fetch":""},"$required":false,"options":[{"label":"正常","value":2},{"label":"异常","value":3}],"_fc_id":"id_Frn0lxwm8a79k4c","name":"ref_Fx29lxwm8a79k5c","display":true,"hidden":false,"_fc_drag_tag":"radio","slot":"7:3"},{"type":"div","title":"","native":true,"children":["下肢"],"_fc_id":"id_Fnbzlxwm2665iec","name":"ref_F6yflxwm2665ifc","display":true,"hidden":false,"_fc_drag_tag":"text","slot":"7:4"},{"type":"radio","field":"Fe4xlxwm8b56k6c","title":"","info":"","effect":{"fetch":""},"$required":false,"options":[{"label":"正常","value":2},{"label":"异常","value":3}],"_fc_id":"id_Fuo3lxwm8b56k7c","name":"ref_Fhbplxwm8b56k8c","display":true,"hidden":false,"_fc_drag_tag":"radio","slot":"7:6"}],"_fc_id":"id_Fj5wlxwlkogbcdc","name":"ref_Fnz2lxwlkogccec","display":true,"hidden":false,"_fc_drag_tag":"fcTable"}]'),
      option: option,
      active:1,
      printObj:{
        id:"printTable",
      }
    }
  },
  methods: {

    onSubmit (formData) {
      //todo 提交表单
      //跳转到等待审核通过
      this.$router.push('wait')
    },
    onReset () {
      //todo 提交表单
      //跳转到等待审核通过
    },
    setPath(){
      let data=JSON.parse(localStorage.getItem("data"))
      request.post("/api/student/getByuserId?userId="+data.userId).then(res=>{//通过用户id查找的学生id
        if(res.data!=null){
          request.post("/api/getsId?id="+res.data.sId).then(res=>{
          })
        }

      })
    },
    message(){
      ElMessage.success("上传成功")
    }
  }
}
</script>
<style>
.tijian{
  display: flex;
  height: 60vh;
}
.main{
  display: flex;
  flex-wrap: wrap;
}
.mysite{
  margin-top: -95px;
  z-index: 99;
}
.mysite1{
  margin-top: -95px;
  margin-right: 1000px;
  margin-left: 20px;
  z-index: 99;
}
</style>